﻿using System;

namespace Entities
{
    [Serializable]
    public class tblCouponToProduct
    {
        private int coupon_id;
        private int product_id;

        public tblCouponToProduct() {}

        public tblCouponToProduct(int coupon_id, int product_id)
        {
            this.coupon_id = coupon_id;
            this.product_id = product_id;
        }

        public int couponID
        {
            get { return this.coupon_id; }
            set
            {
                if (value == null)
                    throw new Exception("Mã khuyến mại không được để trống!");
                this.coupon_id = value;
            }
        }

        public int productID
        {
            get { return this.product_id; }
            set
            {
                if (value == null)
                    throw new Exception("Mã sản phẩm không được để trống!");
                this.product_id = value;
            }
        }

        public override string ToString()
        {
            return this.coupon_id + "; " + this.product_id + "; ";
	    }
	    public override bool Equals(Object obj)
	    {
            tblCouponToProduct me = (tblCouponToProduct)obj;
            bool ret = this.couponID.Equals(me.couponID);
	        return ret;
	    }
	    public override int GetHashCode()
	    {
            return this.couponID.GetHashCode();
	    }

    }
}
